import request from "./request"


//发动态
export function addDynamic(dynamic){
    return request({
        url:'/dynamic/addDynamic',
        method:'post',
        data:dynamic
    })
}

//获取关注的人的动态
export function getConcernDynamic(id,type,index){
    return request({
        url:'/dynamic/concernDynamicList/'+id,
        params:{
            type,index
        }
    })
}

//我的动态
export function myDynamic(id,type,index){
    return request({
        url:'/dynamic/dynamicList/'+id,
        params:{
            type,index
        }
    })
}

//删除动态
export function delDynamic(id){  //动态id
    return request({
        url:'/dynamic/delDynamic/'+id,
        method:'delete'
    })
}

//动态点赞
export function like(likeList){
    return request({
        url:'/dynamic/likeDynamic',
        method:'put',
        data:likeList
    })
}

//取消点赞
export function cancelLike(dId,type,uId){
    return request({
        url:'/dynamic/unLikeDynamic/'+dId,
        method:'put',
        params:{
            type,uId
        }
    })
}

//收藏动态
export function favorite(collection){
    return request({
        url:'/collection/collection',
        method:'post',
        data:collection
    })
}

//取消收藏
export function unFavorite(dId,type,uId){
    return request({
        url:'/collection/unCollection/'+dId,
        method:'delete',
        params:{
            uId,type
        }
    })
}


//动态取消图片上传
//删除所有发布动态中的图片
export function removeImg(id,fileNames){
    return request({
        url:'/file/delDynamicImg/'+id,
        method:'delete',
        data:fileNames
    })
}



//获取动态评论
export function getComments(did,type){
    return request({
        url:'/comment/comment/'+did,
        params:{
            type
        }
    })
}

//发布评论
export function addComment(comment){
    return request({
        url:'/comment/comment',
        method:'post',
        data:comment
    })
}

//删除评论
export function delComment(cId){
    return request({
        url:'/comment/comment/'+cId,
        method:'delete'
    })
}

//评论点赞取消点赞
export function likeComment(likeComment){
    return request({
        url:'/comment/like',
        method:'post',
        data:likeComment
    })
}
